/*
 * One example for NOI CSP-J Lesson 10:
 * <https://courses.fmsoft.cn/plzs/noijunior-csp-exercises-lower.html>
 *
 * Author: Vincent Wei
 *  - <https://github.com/VincentWei>
 *  - <https://gitee.com/vincentwei7>
 *
 * Copyright (C) 2025 FMSoft <https://www.fmsoft.cn>.
 * License: GPLv3
 */
#include <iostream>
#include <bitset>
#include <cassert>

using namespace std;

int take_apples(int n, int& day_got_n)
{
    day_got_n = 0;
    int days = 0;
    int left = n;
    while (left > 0) {
        int nr_taken = 0;
        for (int i = 1, j = 1; i <= left; i += 3, j += 2) {
            if (day_got_n == 0 && i == left)
                day_got_n = days + 1;
            nr_taken++;
        }

        left -= nr_taken;
        days++;
    }

    return days;
}

int main()
{
    int days, day_got_n;

    days = take_apples(1, day_got_n);
    assert(days == 1);
    assert(day_got_n == 1);

    days = take_apples(4, day_got_n);
    assert(days == 3);
    assert(day_got_n == 1);

    days = take_apples(8, day_got_n);
    assert(days == 5);
    assert(day_got_n == 5);

    int n;
    cin >> n;
    days = take_apples(n, day_got_n);
    cout << days << " " << day_got_n << endl;
    return 0;
}

